package com.ruoyi.wechat.service.impl;

import com.ruoyi.wechat.domain.menu.ButtonList;
import com.ruoyi.wechat.service.ButtonService;
import com.ruoyi.wechat.util.CommonUtil;
import com.ruoyi.wechat.util.ConstantWeChat;
import com.ruoyi.wechat.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
@Service
public class ButtonServiceImp implements ButtonService {
	@Autowired
	private TokenUtil tokenUtil;
	@Override
	public JSONObject createMenu(ButtonList buttonList, String APPKEY) {
		// TODO Auto-generated method stub
		String xml = JSONObject.toJSONString(buttonList);
		return CommonUtil.doPostStr(ConstantWeChat.CREATMENU.replace("#ACCESS_TOKEN#", tokenUtil.getToken(APPKEY).getAccessToken()), xml);
	}

}
